import { Sale } from "@prisma/client"

interface SalesReportProps {
  sales: Sale[]
}

export function SalesReport({ sales }: SalesReportProps) {
  return (
    <div className="overflow-x-auto">
      <table className="min-w-full divide-y divide-gray-200">
        <thead className="bg-gray-50">
          <tr>
            <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">销售单号</th>
            <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">总金额</th>
            <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">创建时间</th>
          </tr>
        </thead>
        <tbody className="bg-white divide-y divide-gray-200">
          {sales.map((sale) => (
            <tr key={sale.id}>
              <td className="px-6 py-4 whitespace-nowrap text-gray-700">{sale.code}</td>
              <td className="px-6 py-4 whitespace-nowrap text-gray-700">¥{sale.totalAmount.toFixed(2)}</td>
              <td className="px-6 py-4 whitespace-nowrap text-gray-700">{new Date(sale.createdAt).toLocaleString()}</td>
            </tr>
          ))}
        </tbody>
      </table>
    </div>
  )
} 